#ifndef _network_NetworkMessage_hpp_
#define _network_NetworkMessage_hpp_

/** \file NetworkMessage.hpp NetworkMessage's for network stuff
 *  \author Micha Begert
 *  \created  $Sa 20 Okt 19:02:00 pm CEST 2007
 *  \modified $Sa 20 Okt 19:02:00 pm CEST 2007
 */
#include "../core/types.hpp"

namespace network {

    using namespace core::types;

    static const int ID_NETWORK_MESSAGE_BEGIN = 70;

    enum networkMessages{
        CLIENT_HELLO = 70,
        CLIENT_BYE,
        CLIENT_CONNECT,
        CLIENT_DISTRIBUTE,
        CLIENT_DISCONNECT,
        CLIENT_DISCONNECT_NOTIFY
    };

    struct  ClientHello
    {
        ClientHello(int version)
        :   m_version(version)
        { }

        static const int m_msgId = ID_NETWORK_MESSAGE_BEGIN;
        union {
            struct {
                uint8 major;
                uint8 minor;
            };
            uint16 m_version;
        };
    };

    struct  ClientBye
    {
        ClientBye(const std::string& reason)
        :   m_reason(reason)
        { }

        static const int m_msgId = ID_NETWORK_MESSAGE_BEGIN + 1;
        std::string      m_reason;
    };

    struct  ClientConnect
    {
        ClientConnect(Client::Id cId)
        :   m_ClientId(cId)
        { }

        static const int m_msgId = ID_NETWORK_MESSAGE_BEGIN + 2;
        Client::Id       m_ClientId;
    };

    struct  ClientDistribute
    {
        ClientDistribute(Client::Id cId)
        :   m_ClientId(cId)
        { }

        static const int m_msgId = ID_NETWORK_MESSAGE_BEGIN + 3;
        Client::Id       m_ClientId;
    };

    struct  ClientDisconnect
    {
        ClientDisconnect(const std::string& reason)
        :   m_Reason(reason)
        { }

        static const int   m_msgId = ID_NETWORK_MESSAGE_BEGIN + 4;
        std::string        m_Reason;
    };

    struct  ClientDisconnectNotify
    {
        ClientDisconnectNotify(Client::Id cId, const std::string& reason)
        :   m_ClientId(cId), m_Reason(reason)
        { }

        static const int   m_msgId = ID_NETWORK_MESSAGE_BEGIN + 5;
        Client::Id         m_ClientId;
        std::string        m_Reason;
    };
}

#endif // _network_NetworkMessage_hpp_